Action hook 'update_option_{$option}'

in WP Core File wp-includes/option.php at line 1020

View Source

update_option_{$option}

Action Hook
Description
Fires after the value of a specific option has been successfully updated. The dynamic portion of the hook name, `$option`, refers to the option name.

Hook Information

File Location wp-includes/option.php View on GitHub
Hook Type Action
Line Number 1020

Hook Parameters

Type Name Description
mixed $old_value The old option value.
mixed $value The new option value.
string $option Option name.

Usage Examples

Basic Usage
<?php
// Hook into update_option_{$option}
add_action('update_option_{$option}', 'my_custom_function', 10, 3);

function my_custom_function($old_value, $value, $option) {
    // Your custom code here
}

Source Code Context

wp-includes/option.php:1020 - How this hook is used in WordPress core
<?php
1015  	 *
1016  	 * @param mixed  $old_value The old option value.
1017  	 * @param mixed  $value     The new option value.
1018  	 * @param string $option    Option name.
1019  	 */
1020  	do_action( "update_option_{$option}", $old_value, $value, $option );
1021  
1022  	/**
1023  	 * Fires after the value of an option has been successfully updated.
1024  	 *
1025  	 * @since 2.9.0

PHP Documentation

<?php
/**
	 * Fires after the value of a specific option has been successfully updated.
	 *
	 * The dynamic portion of the hook name, `$option`, refers to the option name.
	 *
	 * @since 2.0.1
	 * @since 4.4.0 The `$option` parameter was added.
	 *
	 * @param mixed  $old_value The old option value.
	 * @param mixed  $value     The new option value.
	 * @param string $option    Option name.
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 3
  • File: wp-includes/option.php
Related Hooks

Related hooks will be displayed here in future updates.